Skip to content

[18.0][ADD] queue_job_is_running#942

Open
Saran440 wants to merge 1 commit into
OCA:18.0from
ecosoft-odoo:18.0-add-queue_job_alert_running
Open

[18.0][ADD] queue_job_is_running#942
Saran440 wants to merge 1 commit into
OCA:18.0from
ecosoft-odoo:18.0-add-queue_job_alert_running

Conversation

@Saran440

@Saran440 Saran440 commented Jun 4, 2026

Copy link
Copy Markdown
Member

This module adds a warning banner and a new boolean field (is_job_running) to help users understand that a document's status is running. Developers can also hide buttons to prevent users from clicking them and creating duplicate jobs.

Screenshot 2026-06-04 165005

@OCA-git-bot OCA-git-bot added series:18.0 mod:queue_job_alert_running Module queue_job_alert_running labels Jun 4, 2026

@amh-mw amh-mw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conceptually, I really like this module, as I have a number of long-running jobs that would enjoy the visibility.

Comment thread queue_job_alert_running/readme/USAGE.md Outdated
@Saran440

Saran440 commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@amh-mw Thank you for your feedback. I will check it.

@Saran440
Saran440 force-pushed the 18.0-add-queue_job_alert_running branch 3 times, most recently from c283bf8 to 9bd399f Compare July 17, 2026 07:43
@Saran440

Copy link
Copy Markdown
Member Author

Update is_job_running to be a compute field.
Other module just inherit queue.job.status.mixin and it ready to use.

Example Code

class AccountMove(models.Model):
    _name = "account.move"
    _inherit = ["account.move", "queue.job.status.mixin"]

    def action_confirm_queue(self):
        return self.with_delay().action_post()

@amh-mw amh-mw left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename the module to queue_job_is_running or queue_job_banner?

_name = "queue.job.status.mixin"
_description = "Queue Job Status Mixin"

is_job_running = fields.Boolean(compute="_compute_is_job_running")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change Boolean is_job_running field to Char jobs_running to include the name(s) of running job(s)?

jobs = (
self.env["queue.job"]
.sudo()
.search_fetch(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of search_fetch here, bypass ORM and use PostgreSQL native JSON operators to check for record intersection instead of querying all records for the model? Something like records->'ids' ?| %(self.ids)s? (Pseudo-SQL, certainly wrong.) That might want an index.

@OCA-git-bot OCA-git-bot added the mod:queue_job_is_running Module queue_job_is_running label Jul 25, 2026
@Saran440
Saran440 force-pushed the 18.0-add-queue_job_alert_running branch from 99b1049 to ea273e9 Compare July 25, 2026 12:27
@OCA-git-bot OCA-git-bot removed the mod:queue_job_alert_running Module queue_job_alert_running label Jul 25, 2026
@Saran440 Saran440 changed the title [18.0][ADD] queue_job_alert_running [18.0][ADD] queue_job_is_running Jul 25, 2026
@Saran440

Copy link
Copy Markdown
Member Author

Fixed.

  1. Rename module to queue_job_is_running
  2. Change field name is_job_running from boolean to running_job_names char
  3. Compute with Raw SQL for performance

@amh-mw Thank you for your time :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:queue_job_is_running Module queue_job_is_running series:18.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants